<?php

namespace Modules\Order\Entities;

use Modules\Order\Entities\Order;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Payment extends Model
{
    use SoftDeletes;

    const CHANNEL_WECHAT = 1;

    // 支付方式 0：未发启支付 1：线上支付 2：线下支付；3：积分支付；4：积分+线上支付；5：积分+线下支付；6：会员卡支付
    const METHOD_NONE = 0;
    const METHOD_ONLINE = 1;
    const METHOD_OFFLINE = 2;

    // 支付状态 0：未发启支付 1：支付中 2：支付成功 3：支付失败'
    const STATUS_NONE = 0;
    const STATUS_PAYING = 1;
    const STATUS_SUCCESS = 2;
    const STATUS_FAIL = 3;

    protected $fillable = ['price', 'discount_price', 'delivery_fee', 'delivery_discount', 'total'];

    public function order()
    {
        return $this->belongsTo(Order::class);
    }
}
